package com.example.lanqiaodemo.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//这是一个配置类
@Configuration
public class webConfig implements WebMvcConfigurer {
    @Value("${my.uploadPath}")
    private String uploadFilePath;
    // 专门用来配置静态资源
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //静态资源映射
        registry.addResourceHandler("/static/**").addResourceLocations("file:"+uploadFilePath);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }
}
